import datetime
import functools


def formatTime1():
    """
    # 时间格式化函数
    :return: 2020年02月01日
    """
    return datetime.date.today().strftime('%Y{}%m{}%d{}').format(*'年月日')


def formatTime2():
    """
    # 时间格式化
    :return:
    """
    return datetime.date.today().strftime('%Y{}%m{}%d').format(*'///')


def printLdj():
    try:
        1/0
    except Exception as e:
        print(e)


class Pair:
    def __init__(self, first, second):
        self.first = first
        self.second = second


import random


class Char:
    letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
    digits = '0123456789'

    @classmethod
    def random_letter(cls):
        return random.choice(cls.letters)

    @classmethod
    def random_digits(cls):
        return random.choice(cls.digits)

    @property
    def xiao(self):
        return self._xiao

    @xiao.setter
    def xiao(self, value):
        self._xiao = value


def passwd(password):
    password_length = password
    password_length = int(password_length)
    if password_length < 8 or password_length > 20:
        raise ValueError('密码长度不符')


def xiao(a,*num):
    print(a)
    print(num)
    print(type(num))

def timeor(func):
    @functools.wraps(func)
    def wrapper(*args, **akw):
        print('[', datetime.datetime.now(), ']')
        return func(*args, **akw)
    return wrapper


def time(func):
    def wrapper(*args, **kw):
        print('[', datetime.datetime.now(), ']')
        return func(*args, **kw)
    return wrapper

@time
def sayHello():
    print("hello world")


if __name__ == '__main__':
    print(sayHello.__name__)
    print("今天的 "+ formatTime2())
    print("This is a apple")
    seconds_per_day = 60 * 60 * 24
    print(seconds_per_day)
    pair = Pair(10,20)
    print(pair.first)
    print(pair.second)
    printLdj()
    letters = ['a','b','c']
    print(letters.reverse())
    print(letters)
    letters = letters[::-1]
    print(letters)
    letters.sort(reverse=True)
    print(letters)
    print("this is a apple xiaoxiao")
    numbers = (1, 2, 3, 4, 5)
    print(numbers[::-1])
    xiao(1)
    char = Char()
    char.xiao = "lidejin"
    print(char.xiao)
